#include <cstdio>


inline int get_int (int &n)
{
	scanf ("%d", &n);
	return n;
}


inline int abs (int n)
{
	return n >= 0 ? n : -n;
}


inline int gcd (int a, int b)
{
	int r;

	if (b == 0)
		return a;
	
	while (r = a % b)
	{
		a = b;
		b = r;
	}

	return b;
}


int main ()
{
	int an, a1, mcd;

	while (get_int(a1))
	{
		get_int(an);
		mcd = a1 == an ? a1 : a1 - an;
		while (get_int(an))
		{
			mcd = gcd(mcd, a1 - an);
		}
		printf("%d\n", abs(mcd));
	}

	return 0;
}